package com.sc.nft.dao;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.MallLogistics;
import com.sc.nft.entity.MallUserActivityRankingDetail;
import com.sc.nft.mapper.MallUserActivityRankingDetailMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;


/**
 * IP商城活动兑换配置表(sc_mall_activity_exchange)数据DAO
 *
 * @author zxy
 * @description IP商城
 * @since 2023-05-10 16:59:01
 */
@Slf4j
@Repository
public class MallUserActivityRankingDetailDao extends ServiceImpl<MallUserActivityRankingDetailMapper, MallUserActivityRankingDetail> {


    /**
     * 获取排行榜
     *
     * @param rankingCycleId
     */
    public List<MallUserActivityRankingDetail> getUserRanking(Long rankingCycleId, Integer limit, BigDecimal thresholdAmount) {
        return baseMapper.getUserRanking(rankingCycleId, limit, thresholdAmount);
    }

    /**
     * 获取排行榜
     *
     * @param rankingCycleId
     */
    public Page<MallUserActivityRankingDetail> queryUserRankingPage(IPage page, Long rankingCycleId, Integer limit,String phoneNumber,BigDecimal thresholdAmount) {
        return baseMapper.queryUserRankingPage(page,rankingCycleId, limit,phoneNumber,thresholdAmount);
    }



    /**
     * 累计确认收货金额
     *
     * @param userId
     * @param confirmedTotalAmount
     */
    public void updateConfirmedTotalAmount(Long userId, Long rankingCycleId, BigDecimal confirmedTotalAmount) {
        baseMapper.updateConfirmedTotalAmount(userId, rankingCycleId, confirmedTotalAmount);
    }

    /**
     * 累计消费金额
     *
     * @param userId
     * @param totalAmount
     */
    public void updateTotalAmount(Long userId, Long rankingCycleId, BigDecimal totalAmount) {
        baseMapper.updateTotalAmount(userId, rankingCycleId, totalAmount);
    }


}